﻿#region 命名空间

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WinnerCMS.BLL.Counter;

#endregion

namespace WinnerCMS.WebUI.Controllers
{
    public class CounterController : Controller
    {
        // GET: Counter
        public ActionResult Index(string style)
        {
            var context = System.Web.HttpContext.Current;
            var serverVariables = context.Request.ServerVariables;


            var theurl = "http://" + serverVariables["HTTP_HOST"];


            var js = "document.write(\"<script>var style='" + style + "';</script>\");";
            js += "\n_dwrite(\"<script language=javascript src=" + theurl +
                  "/Counter/Record?style=\"+style+\"&referer=\"+escape(document.referrer)+\"&screenwidth=\"+(screen.width)+\"&screenheight=\"+(screen.height)+\"></script>\");";
            js += "\nfunction _dwrite(string) {document.write(string);}";
            return Content(js);
        }

        public ActionResult Record(string style)
        {
            var context = System.Web.HttpContext.Current;


            CounterManage.TongJi(context);
            return Content("");
        }
    }
}